<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>homework4</title>
</head>
<body>
<pre>
    from time import sleep
class Person:
    def __init__(self,name,age):
        self.name = name
        self.age = age

    def speak(self):
        print(f'姓名:{self.name}\t年龄:{self.age}',end='')


class Student(Person):
    def __init__(self,name,age,shool,my_id):
        super().__init__(name,age)
        self.shool = shool
        self.my_id = my_id

    def speak(self):
        super().speak()
        print(f'\t学校:{self.shool}\t学号:{self.my_id}',end='')

class CollegeStudent(Student):
    def __init__(self,name,age,shool,my_id,language):
        super().__init__(name,age,shool,my_id)
        self.language = language

    def speak(self):
        super().speak()
        print(f'\t语言:{self.language}', end='')

    def encoding(self):
        words = ' I am coding . . . . . . . . . .'
        delay = 10/len(words)
        for word in words:
            print(word,end="",flush=True)
            sleep(delay)

student = Student('小明',13,'西安理工大学','31002')
student.speak() # 子类方法
print()
super(Student,student).speak() # 调用父类方法
print()

collegeStudent = CollegeStudent('大明',13,'西安理工大学','31002','chinese')
collegeStudent.speak()
print()
super(CollegeStudent,collegeStudent).speak()# 调用Student父类方法
print()
super(Student,collegeStudent).speak()# 调用Person父类方法
print()
collegeStudent.encoding() # 10秒打印出
</pre>
</body>
</html>